home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 53 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.8 KB  |  49 lines

  1. Newsgroups: comp.lang.c
  2. Path: news.sprintlink.net!eskimo!news
  3. From: mag@eskimo.com (mAg)
  4. Subject: Re: strange problem with strcpy()
  5. X-Nntp-Posting-Host: tia1.eskimo.com
  6. Message-ID: <DKHzHF.4wF@eskimo.com>
  7. Sender: news@eskimo.com (News User Id)
  8. Organization: *.*
  9. X-Newsreader: WinVN 0.93.10
  10. References: <DKFsII.FyJ@iglou.com>
  11. Date: Mon, 1 Jan 1996 10:22:25 GMT
  12.  
  13. In article <DKFsII.FyJ@iglou.com> (Sun, 31 Dec 1995 05:56:41 GMT), quare@iglou2.iglou.com 
  14. says :
  15. >
  16. >Some background.  tc++ 3.0 for dos.  Basically I have this routine that 
  17. >reads in files from the current directory and makes an malloc'ed array of 
  18. >structures which hold info about those files (attribs, filename/ext, size,
  19. >etc.).  More detailed info on request.
  20. >
  21. >Anyway, this routine uses a pointer to write to this 'array'.  (as in:
  22. >pointer->name, pointer->size, etc.).  strcpy(pointer->name, 
  23. >fileinfo->name) (fileinfo is the structure written to by the dos service) 
  24. >*sometimes* works, yet sometimes it will place a \0 in the first position 
  25. >of pointer->name.  for example..
  26. >
  27. >if fileinfo->name == "test.c", strcpy will place "\0est.c" into 
  28. >pointer->name.  Any clues as to how this is happening?  And no, 
  29. >pointer->name was not "test.c" before the call to strcpy().  Please... I 
  30. >beg of you... :(
  31. >
  32.  
  33. Eventhough the above text tells about the problem you are having, many C gurus here on clc 
  34. will be able to help you better if you post the code.
  35.  
  36. >-- 
  37. >!quare 
  38. >
  39.  
  40. -- 
  41. /* --------------------------------------------------------
  42.                       MAG@ESKIMO.COM
  43. http://www.eskimo.com/~mag/index.html
  44. ***********************************************************
  45. To understand recursion one must first understand recursion
  46. ***********************************************************
  47. -------------------------------------------------------- */
  48.  
  49.